﻿<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls"
    Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Register TagPrefix="wssuc" TagName="InputFormSection" Src="~/_controltemplates/InputFormSection.ascx" %>
<%@ Register TagPrefix="wssuc" TagName="InputFormControl" Src="~/_controltemplates/InputFormControl.ascx" %>
<%@ Register TagPrefix="wssuc" TagName="ButtonSection" Src="~/_controltemplates/ButtonSection.ascx" %>
<%@ Register TagPrefix="wssawc" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Assembly Name="Winwise.SPWebConfig.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=497a758e307ba99d" %>

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ManageWebConfigModif.aspx.cs"
    Inherits="Winwise.SPWebConfig.UI.ManageWebConfigModif" MasterPageFile="~/_admin/admin.master" %>

<asp:Content ID="PageHead" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
</asp:Content>
<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
    <table width="100%" class="propertysheet" cellspacing="0" cellpadding="0" border="0">
        <tr>
            <td class="ms-descriptionText">
                <asp:Label ID="LabelMessage" runat="server" EnableViewState="False" class="ms-descriptionText" />
            </td>
        </tr>
        <tr>
            <td class="ms-error">
                <asp:Label ID="LabelErrorMessage" runat="server" EnableViewState="False" />
            </td>
        </tr>
        <tr>
            <td class="ms-descriptionText">
                <asp:ValidationSummary ID="ValSummary" HeaderText="<%$SPHtmlEncodedResources:spadmin, ValidationSummaryHeaderText%>"
                    DisplayMode="BulletList" ShowSummary="True" runat="server"></asp:ValidationSummary>
            </td>
        </tr>
    </table>
    <table border="0" cellspacing="0" cellpadding="0" width="100%">
        <wssuc:InputFormSection runat="server" Id="idWebApplicationSelectorSection" Title="<%$Resources:spadmin, multipages_webapplication_title%>"
            Description="<%$Resources:spadmin, multipages_webapplication_desc%>">
            <template_inputformcontrols>
			        <tr><td>
			        <SharePoint:WebApplicationSelector id="Selector" runat="server"
				        OnContextChange="OnContextChange" />
			        </td></tr>
		        </template_inputformcontrols>
        </wssuc:InputFormSection>
  <%--<asp:GridView runat=server>
  <HeaderStyle VerticalAlign=
  </asp:GridView>--%>
         <wssuc:inputformsection title="List of Web.config Modifications" runat="server">
		        <Template_Description>
                    <div style="width:200px">
			         Here is the list of web.config modifications.<br />
                     You can edit or delete them
                    </div>
		        </Template_Description>
		        <Template_InputFormControls>
			         <wssuc:InputFormControl LabelText="Web.config Modification" runat="server">
				        <Template_control>
                          <div style="min-width:500px">
                            
                             <SharePoint:SPGridView runat="server" ID="GVModifs" AutoGenerateColumns="false" Width="100%"  
                                AllowSorting="true"  >
                                <HeaderStyle BackColor="#cccccc" Height="30" VerticalAlign="top" />
                                <RowStyle BackColor="#eeeeee" />
                                <AlternatingRowStyle BackColor="#dddddd"  />
                                <Columns>
                                    <asp:TemplateField HeaderText="Type" ItemStyle-CssClass="ms-cbp" HeaderStyle-CssClass="ms-cbp"
                                        ItemStyle-VerticalAlign="Top"  >
                                        <ItemTemplate>
                                            <%# ((Winwise.SPWebConfig.Core.WebConfigModification)Container.DataItem).FriendlyTypeName %>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Name" ItemStyle-CssClass="ms-cbp" HeaderStyle-CssClass="ms-cbp"
                                        ItemStyle-VerticalAlign="Top">
                                        <ItemTemplate>
                                            <%# ((Winwise.SPWebConfig.Core.WebConfigModification)Container.DataItem).DisplayName %>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Zone" ItemStyle-CssClass="ms-cbp" HeaderStyle-CssClass="ms-cbp"
                                        ItemStyle-VerticalAlign="Top">
                                        <ItemTemplate>
                                            <asp:Label runat="server" ID="LblZone" />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Edit" ItemStyle-CssClass="ms-cbp" HeaderStyle-CssClass="ms-cbp"
                                        ItemStyle-VerticalAlign="Top">
                                        <ItemTemplate>
                                            <asp:Label ID="LblNotSupported" runat="server" Text="Not supported" />
                                            <asp:HyperLink runat="server" ID="LinkAddEdit" Text="Edit" rel="sp_DialogLinkInternal" />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Delete" ItemStyle-CssClass="ms-cbp" HeaderStyle-CssClass="ms-cbp"
                                        ItemStyle-VerticalAlign="Top">
                                        <ItemTemplate>
                                            <asp:Button runat="server" Text="Delete" OnCommand="ClickDelete" CommandArgument="<%# Container.DataItemIndex %>" />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                            </SharePoint:SPGridView>
                          </div>
				        </Template_control>
			        </wssuc:InputFormControl>
		        </Template_InputFormControls>
	        </wssuc:inputformsection>
            <wssuc:inputformsection title="Apply modification" runat="server">
		        <Template_Description>
			        Select "Full" if you want to unapply and apply all modifications. (this is the mecanism used by standard SharePoint web.config modification)<br />
                    Select "Incremental" If you want to apply only modifications that were added/deleted
		        </Template_Description>
		        <Template_InputFormControls>
			         <wssuc:InputFormControl LabelText="Apply modification" runat="server">
				        <Template_control>
                            <div>
                                <div style="float: left">
                                    <asp:RadioButtonList runat="server" ID="RBModifType" RepeatDirection="Horizontal">
                                        <asp:ListItem Text="Incremental" Selected="True" />
                                        <asp:ListItem Text="Full" />
                                    </asp:RadioButtonList>
                                </div>
                                <div style="float: left">
                                    <asp:Button ID="Button1" runat="Server" Text="Apply web.config modifications" OnClick="ApplyWebConfigModif" />
                                </div>
                            </div>
				        </Template_control>
			        </wssuc:InputFormControl>
		        </Template_InputFormControls>
	        </wssuc:inputformsection>
             <wssuc:inputformsection title="Add modification" runat="server">
		        <Template_Description>
			      Select the type of modification to add
		        </Template_Description>
		        <Template_InputFormControls>
			         <wssuc:InputFormControl LabelText="Add modification" runat="server">
				        <Template_control>
                            <asp:Repeater runat="server" ID="RepeaterAdd">
                                <SeparatorTemplate><br /><br /></SeparatorTemplate>
                                <ItemTemplate>
                                     <a href="<%# ((Winwise.SPWebConfig.UI.ViewAddWebModif)Container.DataItem).AdminUrl%>" rel="sp_DialogLinkInternal"><%# ((Winwise.SPWebConfig.UI.ViewAddWebModif)Container.DataItem).Name %></a>.
                                     <br /> <i><%# ((Winwise.SPWebConfig.UI.ViewAddWebModif)Container.DataItem).Description %></i>
                                </ItemTemplate>
                            </asp:Repeater>
                         
				        </Template_control>
			        </wssuc:InputFormControl>
		        </Template_InputFormControls>
	        </wssuc:inputformsection>

               <wssuc:inputformsection title="Logs" runat="server">
		        <Template_Description>
			        List of modification logs. You can sort the grid view, and clear its content
		        </Template_Description>
		        <Template_InputFormControls>
			         <wssuc:InputFormControl LabelText="Logs" runat="server">
				        <Template_control>
                          <SharePoint:SPGridView runat="server" ID="GVLogs" AutoGenerateColumns="false" Width="100%"
                                AllowSorting="true">
                                 <HeaderStyle BackColor="#cccccc"  VerticalAlign="top" />
                                <RowStyle BackColor="#eeeeee" />
                                <AlternatingRowStyle BackColor="#dddddd"  />
                                <Columns>
                                    <asp:TemplateField HeaderText="Date" ItemStyle-CssClass="ms-cbp" HeaderStyle-CssClass="ms-cbp"
                                        ItemStyle-VerticalAlign="Top" SortExpression="Date">
                                        <ItemTemplate>
                                            <%# ((Winwise.SPWebConfig.UI.ViewLog)Container.DataItem).Date.ToString()%>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Server" SortExpression="Server" ItemStyle-CssClass="ms-cbp"
                                        HeaderStyle-CssClass="ms-cbp" ItemStyle-VerticalAlign="Top">
                                        <ItemTemplate>
                                            <%# ((Winwise.SPWebConfig.UI.ViewLog)Container.DataItem).Server.DisplayName.ToString()%>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Zone" SortExpression="Zone" ItemStyle-CssClass="ms-cbp"
                                        HeaderStyle-CssClass="ms-cbp" ItemStyle-VerticalAlign="Top">
                                        <ItemTemplate>
                                            <%# ((Winwise.SPWebConfig.UI.ViewLog)Container.DataItem).Zone.ToString()%>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Message" SortExpression="Message" ItemStyle-CssClass="ms-cbp"
                                        HeaderStyle-CssClass="ms-cbp" ItemStyle-VerticalAlign="Top">
                                        <ItemTemplate>
                                            <%#  ((Winwise.SPWebConfig.UI.ViewLog)Container.DataItem).Message.ToString() %>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                            </SharePoint:SPGridView>
                            <asp:Button ID="Button2" runat="Server" Text="Clear Logs" OnClick="ClearLogs" />
				        </Template_control>
			        </wssuc:InputFormControl>
		        </Template_InputFormControls>
	        </wssuc:inputformsection>

              <wssuc:inputformsection title="Errors" runat="server">
		        <Template_Description>
			        List of Errors. You can sort the grid view, and clear its content
		        </Template_Description>
		        <Template_InputFormControls>
			         <wssuc:InputFormControl LabelText="Errors" runat="server">
				        <Template_control>
                          <SharePoint:SPGridView runat="server" ID="GVErrors" AutoGenerateColumns="false" Width="100%"
                                AllowSorting="true">
                                <AlternatingRowStyle CssClass="ms-alternatingstrong" />
                                <Columns>
                                    <asp:TemplateField HeaderText="Date" ItemStyle-CssClass="ms-cbp" HeaderStyle-CssClass="ms-cbp"
                                        ItemStyle-VerticalAlign="Top" SortExpression="Date">
                                        <ItemTemplate>
                                            <%# ((Winwise.SPWebConfig.UI.ViewLog)Container.DataItem).Date.ToString()%>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Server" SortExpression="Server" ItemStyle-CssClass="ms-cbp"
                                        HeaderStyle-CssClass="ms-cbp" ItemStyle-VerticalAlign="Top">
                                        <ItemTemplate>
                                            <%# ((Winwise.SPWebConfig.UI.ViewLog)Container.DataItem).Server.DisplayName.ToString()%>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Zone" SortExpression="Zone" ItemStyle-CssClass="ms-cbp"
                                        HeaderStyle-CssClass="ms-cbp" ItemStyle-VerticalAlign="Top">
                                        <ItemTemplate>
                                            <%# ((Winwise.SPWebConfig.UI.ViewLog)Container.DataItem).Zone.ToString()%>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Error" SortExpression="Message" ItemStyle-CssClass="ms-cbp"
                                        HeaderStyle-CssClass="ms-cbp" ItemStyle-VerticalAlign="Top">
                                        <ItemTemplate>
                                            <%#  ((Winwise.SPWebConfig.UI.ViewLog)Container.DataItem).Message.ToString() %>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                            </SharePoint:SPGridView>
                            <asp:Button ID="Button3" runat="Server" Text="Clear Errors" OnClick="ClearErrors" />
				        </Template_control>
			        </wssuc:InputFormControl>
		        </Template_InputFormControls>
	        </wssuc:inputformsection>

    </table>
   
    
</asp:Content>
<asp:Content ID="PageTitle" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server">
    Web Config Modification page
</asp:Content>
<asp:Content ID="PageTitleInTitleArea" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea"
    runat="server">
    Web Config Modification page
</asp:Content>
